/**
 * 
 */
package org.youisoft.summer.evaluator.eval;

import org.youisoft.summer.evaluator.EvaluateException;
import org.youisoft.summer.evaluator.InvokeException;
import org.youisoft.summer.evaluator.context.CalContext;

import org.youisoft.lifecircle.Destroyable;
import org.youisoft.lifecircle.Initilize;
import org.youisoft.summer.evaluator.operator.Operator;
import org.youisoft.summer.evaluator.unit.UnitVisitor;


/**
 * 
 * @author zijiang.jl
 *
 * @param <R>
 * @param <P>
 */
public interface ExpressionEvaluator<C,R,P> extends Initilize,Destroyable{
	

	/**
	 * 
	 * @param expression
	 * @return
	 * @throws EvaluateException
	 */
	public ExpressionEvaluator<C,R,P> prepare(String expression) throws EvaluateException;

	/**
	 * 
	 * @param context
	 * @param expression
	 * @return
	 */
	public boolean evaluateBoolean(CalContext<C,R,P> context,String expression);
	

	/**
	 * 
	 * @param context
	 * @param expression
	 * @return
	 */
	public Double evaluateDouble(CalContext<C,R,P> context,String expression);

	
	/**
	 * 
	 * @param context
	 * @param expression
	 * @return
	 * @throws EvaluateException
	 * @throws InvokeException
	 */
	public Object evaluate(CalContext<C,R,P> context,String expression) throws EvaluateException,InvokeException;
	
	/**
	 * 
	 * @param context
	 * @param expression
	 * @return
	 * @throws EvaluateException
	 * @throws InvokeException
	 */
	public Object evaluate(CalContext<C,R,P> context) throws EvaluateException,InvokeException;
	/**
	 * 
	 * @param context
	 * @return
	 * @throws EvaluateException
	 * @throws InvokeException
	 */
	public Operator<?> evaluateOperator(CalContext<C,R,P> context) throws EvaluateException,InvokeException;
	
	
	/**
	 * 
	 * @param parenthesisClassName
	 */
	public void setParenthesisClassName(String parenthesisClassName);
	
	/**
	 * 
	 * @param braceClassName
	 */
	public void setBraceClassName(String braceClassName);
	
	/**
	 * 
	 * @param bracketClassName
	 */
	public void setBracketClassName(String bracketClassName);
	
	/**
	 * 
	 * @param parenthesisVisitor
	 */
	public void setVisitor(UnitVisitor<R,P> visitor);
	
	/**
	 * 
	 * @return
	 */
	public UnitVisitor<R,P> getVisitor();
	
	/**
	 * 
	 * @param expressionTransformer
	 */
	public void setExpressionTransformer(ExpressionTransformer expressionTransformer);
	
	/**
	 * 
	 * @return
	 */
	public ExpressionTransformer getExpressionTransformer();
	
	
	/**
	 * 
	 * @param name
	 * @param alias
	 */
	public void registerAlias(String name,String... alias);
	
	/**
	 * 
	 * @param object
	 */
	public void register(Object object);
	
	/**
	 * 
	 * @param name
	 */
	public void unRegister(String name);
	
	
	/**
	 * 
	 * @param name
	 * @param object
	 */
	public void register(String name,Object object);
	
	
	
}
